package com.cjl.service.impl;

import com.cjl.entity.EbNews;
import com.cjl.mapper.NewsMapper;
import com.cjl.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description:用一句话描述
 * @Auther: 李春霞
 * @Date:
 */
@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper newsMapper;

    @Override
    public List<EbNews> listByPage(Integer page, Integer pageSize) {
        System.out.println("Service层--->调用了Service的listByPage方法");
        int from = (page - 1) * pageSize;
        return newsMapper.findByPage(from, pageSize);
    }

    @Override
    public Integer findTotalPage(Integer pageSize) {
        return newsMapper.getTotalPage(pageSize);
    }

    @Override
    public Integer save(EbNews ebNews) {
        return newsMapper.save(ebNews);
    }
    @Override
    public EbNews selectOne(Integer enId){
        return newsMapper.selectOne(enId);
    }
    @Override
    public Integer updateNews ( EbNews ebNews ) {
        return newsMapper.updateByPrimaryKey(ebNews );
    }
    @Override
    public int deleteByPk(int id) {
        return newsMapper.deleteByPk(id);
    }





}
